<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>margin负值的巧妙运用</title>
    <style>
    ul li{
        position: relative;
        float: left;
        list-style: none;
        width: 150px;
        height: 200px;
        border: 1px solid lightblue;
        /* 使边框之间没有空隙和重叠 */
        margin-left: -1px;
    }
    /* ul li:hover{
        1、若没有定位，则鼠标经过添加相对定位即可
        position: relative;
        border:1px solid red;
    } */

    ul li:hover{
        /* 2、若li都有定位，则用z-index提高层级 */
        z-index:1;
        border: 1px solid red;

    }
    </style>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
    </ul>
</body>
</html>